home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / HYPERBOOK2.DMS / in.adf / Macros / sample / TextRange{fname,first,nlines} < prev   
Encoding:
Text File  |  1991-01-29  |  710 b   |  31 lines

  1. /* textrange (file, startline, numlines)
  2.  
  3.    Converts startline and numlines to startbyte and numbytes using
  4.    the textrange program, displays the requested range, and posts the
  5.    byte parameters with 'say'.
  6. */
  7.  
  8.  
  9. address command 'HB_Samples:hbk/textrange >ram:range' arg(1) arg(2) arg(3)
  10.  
  11. if open(fr, 'ram:range', 'r') then do
  12.    line = readln(fr)
  13.    call close(fr)
  14.  
  15.    parse var line '=' start ',' . '=' amt '.'
  16.  
  17.    start = substr(start, 2)
  18.    amt   = substr(amt, 2)
  19.  
  20.    if (length(start) ~= 0) & (amt > 0 | amt = -1) then
  21.       call showtextrange(arg(1), start, amt)
  22.  
  23.    say 'start byte:' start
  24.    say 'byte count:' amt
  25.    address command delete 'ram:range'
  26.  
  27.    end
  28.  
  29. else
  30.    say 'textrange program failed'
  31.